/*
 * @Descripttion:
 * @version:
 * @Author: ChenXiang
 * @Date: 2021-05-19 19:42:54
 * @LastEditors: ChenXiang
 * @LastEditTime: 2021-06-03 17:27:42
 */
import { configureStore, getDefaultMiddleware } from "@reduxjs/toolkit";
import createSagaMiddleware from "redux-saga";
import logger from "redux-logger";
import rootReducer from "./rootReducer";
// import sagas from './sagas';
// 使用saga
const sagaMiddleware = createSagaMiddleware();

// const store = configureStore({
//     reducer: rootReducer,
//     middleware: middlewares,
// });

const store = configureStore({
  reducer: rootReducer,
  // 可以添加自己的中间件,比如打印日志的
  // middleware:[...getDefaultMiddleware({ thunk: false }), sagaMiddleware];
  devTools: true,
});

export type AppDispatch = typeof store.dispatch;
export type RootState = ReturnType<typeof store.getState>;

export default store;
